//
//  CommonFunction.m
//  mmbang
//
//  Created by yaodaobin on 2016/10/26.
//  Copyright © 2016年 iyaya. All rights reserved.
//

#import "CommonFunction.h"
#import <QuartzCore/CALayer.h>
#import <CommonCrypto/CommonDigest.h>
#include <sys/socket.h>
#include <sys/sysctl.h>
#include <net/if.h>
#include <net/if_dl.h>
#include <ifaddrs.h>
#include <arpa/inet.h>
#import "sys/utsname.h"

@implementation CommonFunction

+ (NSString *)getValueFromDic:(NSDictionary *)dictionary withKey:(NSString *)key {
    if (nil == dictionary || ![dictionary isKindOfClass:CLASS(@"NSDictionary")]) {
        return @"";
    }
    id value = [dictionary objectForKey:key];
    if (nil == value || [value isKindOfClass:CLASS(@"NSNull")]) {
        return @"";
    }
    return value;
}

+ (NSMutableArray *)getArrayFromDic:(NSDictionary *)dictionary withKey:(NSString *)key {
    if (nil == dictionary || ![dictionary isKindOfClass:CLASS(@"NSDictionary")]) {
        return [NSMutableArray array];
    }
    id value = [dictionary objectForKey:key];
    if (nil == value || [value isKindOfClass:CLASS(@"NSNull")] || ![value isKindOfClass:CLASS(@"NSArray")]) {
        return [NSMutableArray array];
    }
    return value;
}


+ (NSString *)rangeOfKey:(NSString *)key fromString:(NSString *)stringValue {
    NSString *rangeValue = nil;
    NSRange range = [stringValue rangeOfString:key];
    if (range.location != NSNotFound && range.location < 1000) {
        rangeValue = [stringValue substringFromIndex:range.location + range.length];
    }
    return rangeValue;
}

+ (UIColor *)hexColor:(NSString *)hexColor {
    if ([hexColor hasPrefix:@"#"]) {
        hexColor = [hexColor substringFromIndex:1];
    }
    if ([hexColor length] == 6) {
        hexColor = [hexColor stringByAppendingString:@"64"];
    }
    unsigned int red, green, blue, alpha;
    NSRange range;
    range.length = 2;
    
    range.location = 0;
    [[NSScanner scannerWithString:[hexColor substringWithRange:range]] scanHexInt:&red];
    range.location = 2;
    [[NSScanner scannerWithString:[hexColor substringWithRange:range]] scanHexInt:&green];
    range.location = 4;
    [[NSScanner scannerWithString:[hexColor substringWithRange:range]] scanHexInt:&blue];
    range.location = 6;
    [[NSScanner scannerWithString:[hexColor substringWithRange:range]] scanHexInt:&alpha];
    
    return [UIColor colorWithRed:(float)(red/255.0f) green:(float)(green/255.0f) blue:(float)(blue/255.0f) alpha:(float)(alpha/100.0f)];
}

+ (UIFont *)defaultFontWithSize:(CGFloat)aSize {
    return [UIFont systemFontOfSize:aSize];
}

+ (UIFont *)defaultFontWithBoldSize:(CGFloat)aSize {
    return [UIFont boldSystemFontOfSize:aSize];
}

/**
 *	@brief	显示警告信息
 *
 *	@param 	title 	警告标题
 *	@param 	content 	警告内容
 */
+ (UIAlertController *) showAlert:(NSString *)title Content:(NSString *)content {
    if (![self isBlank:content]) {
        NSString *str = @" ";
        if (![self isBlank:title]) {
            str = title;
        } else {
            str = @"提示";
        }
        UIAlertController *alertview = [UIAlertController alertControllerWithTitle:@"提示" message:@"Successful" preferredStyle:UIAlertControllerStyleAlert];
        // 设置按钮
        UIAlertAction *cancel=[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil];
        UIAlertAction *defult = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:nil];
        [alertview addAction:cancel];
        [alertview addAction:defult];
        return alertview;
    } else {
        UIAlertController *alertview = [UIAlertController alertControllerWithTitle:@"提示" message:@"Successful" preferredStyle:UIAlertControllerStyleAlert];
        // 设置按钮
        UIAlertAction *cancel=[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil];
        UIAlertAction *defult = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:nil];
        [alertview addAction:cancel];
        [alertview addAction:defult];
        return alertview;
    }
}

/**
 *	@brief	 判断object是否为空
 *
 *	@param 	obj 	需判断对象
 *
 *	@return	返回BOOL值
 */
+ (BOOL)isBlank:(id)obj {
    if(obj == [NSNull null] || obj == nil)return YES;
    if([obj isKindOfClass:[NSArray class]])
        return [obj count]==0;
    if([obj isKindOfClass:[NSMutableArray class]])
        return [obj count]==0;
    if([obj isKindOfClass:[NSDictionary class]])
        return [obj count]==0;
    if([obj isKindOfClass:[NSMutableDictionary class]])
        return [obj count]==0;
    if([obj isKindOfClass:[NSData class]])
        return [obj length]==0;
    if([obj isKindOfClass:[NSString class]])
        return [obj length]==0;
    return NO;
}

/**
 *	@brief	判断是否为Null类型
 *
 *	@param 	obj 	需判断的Null
 *
 *	@return	返回BOOL值
 */
+ (BOOL)isNull:(id)obj {
    if(obj == [NSNull null] || obj == nil)return YES;
    return NO;
}

/**
 *	@brief	格式化时间
 *
 *	@param 	aDate       需格式化的时间（NSDate类型）
 *	@param 	aFormat 	格式化的样式
 *
 *	@return	返回格式化后时间（返回NSString类型时间）
 */
+ (NSString *)stringFromDate:(NSDate *)aDate format:(NSString *)aFormat {
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    [formatter setTimeZone:[NSTimeZone defaultTimeZone]];
    [formatter setDateFormat:aFormat];
    NSString *dateString = [formatter stringFromDate:aDate];
    return dateString;
}

/**
 *	@brief	格式化时间
 *
 *	@param 	string      需格式化时间（NSString类型）
 *	@param 	aFormat 	格式化样式
 *
 *	@return	返回格式化后时间（返回NSDate类型）
 */
+ (NSDate *)dateFromString:(NSString *)string format:(NSString *)aFormat {
    if ([string length] == 0) {
        return [NSDate date];
    }
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    [formatter setTimeZone:[NSTimeZone defaultTimeZone]];
    [formatter setDateFormat:aFormat];
    NSDate *date = [formatter dateFromString:string];
    return date;
}

+ (int)daysFromDateString:(NSString *)string1 toDateString:(NSString *)string2 {
    NSDateFormatter *dateFormatter=[[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat:@"yyyy-MM-dd"];
    
    NSDate *date1=[dateFormatter dateFromString:string1];
    NSDate *date2=[dateFormatter dateFromString:string2];
    
    NSTimeInterval time=[date2 timeIntervalSinceDate:date1];
    
    int days=((int)time)/(3600*24);
    if (days<0) {
        days = 0;
    }
    //    int hours=((int)time)%(3600*24)/3600;
    return days;
}

+ (NSString *)localDate {
    NSDate *dates = [NSDate date];
    NSDateFormatter *formatter =  [[NSDateFormatter alloc] init];
    [formatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSTimeZone* timeZone = [NSTimeZone timeZoneWithName:@"Asia/beijing"];
    [formatter setTimeZone:timeZone];
    return [formatter stringFromDate:dates];
}


+ (BOOL)validatePaymentPassword:(NSString *)password {
    NSString *passwordRegex = @"(?!^\\d+$)(?!^[a-zA-Z]+$).{8,}";
    NSPredicate *passwordTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",passwordRegex];
    return [passwordTest evaluateWithObject:password];
}

/**
 *	@brief	正则校验-邮箱
 *
 *	@param 	email 	输入邮箱
 *
 *	@return	返回是否合法邮箱（BOOL）
 */
+ (BOOL)validateEmail:(NSString *)email {
    NSString *emailRegex = @"^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$";
    NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegex];
    return [emailTest evaluateWithObject:email];
}

/**
 *	@brief	正则校验-用户ID
 *
 *	@param 	userId 	输入用户ID
 *
 *	@return	返回是否合法用户ID（BOOL）
 */
+ (BOOL)validateUserId:(NSString *)userId {
    NSString *userIdRegex = @"[a-zA-Z0-9_\u4e00-\u9fa5]+$";
    NSPredicate *userIdTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", userIdRegex];
    return [userIdTest evaluateWithObject:userId];
}

/**
 *	@brief	正则校验-手机号码
 *
 *	@param 	mobileNum 	输入手机号码
 *
 *	@return	返回是否合法手机号码（BOOL）
 */
+ (BOOL)validateMobile:(NSString *)mobileNum {
    if ([mobileNum characterAtIndex:0] != '1' || [mobileNum length] != 11) {
        return NO;
    }
    return YES;
}

/**
 *	@brief	正则校验-汉字
 *
 *	@param 	value 	输入汉字
 *
 *	@return	返回是否汉字（BOOL）
 */
+ (BOOL)validateChinese:(NSString *)value {
    NSString *valueRegex = @"^[\u4e00-\u9fa5]+$";
    NSPredicate *valueTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", valueRegex];
    return [valueTest evaluateWithObject:value];
}

/**
 *	@brief	正则校验-身份证号码
 *
 *	@param 	value 	输入身份证号码
 *
 *	@return	返回是否合法身份证号（BOOL）
 */
+ (BOOL)validateIdCard:(NSString *)value {
    NSString *valueRegex1 = @"^((11|12|13|14|15|21|22|23|31|32|33|34|35|36|37|41|42|43|44|45|46|50|51|52|53|54|61|62|63|64|65|71|81|82|91)\\d{4})((((19|20)(([02468][048])|([13579][26]))0229))|((20[0-9][0-9])|(19[0-9][0-9]))((((0[1-9])|(1[0-2]))((0[1-9])|(1\\d)|(2[0-8])))|((((0[1,3-9])|(1[0-2]))(29|30))|(((0[13578])|(1[02]))31))))((\\d{3}(x|X))|(\\d{4}))";
    NSPredicate *valueTest1 = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", valueRegex1];
    NSString *valueRegex2 = @"^((11|12|13|14|15|21|22|23|31|32|33|34|35|36|37|41|42|43|44|45|46|50|51|52|53|54|61|62|63|64|65|71|81|82|91)\\d{4})((((([02468][048])|([13579][26]))0229))|([0-9][0-9])((((0[1-9])|(1[0-2]))((0[1-9])|(1\\d)|(2[0-8])))|((((0[1,3-9])|(1[0-2]))(29|30))|(((0[13578])|(1[02]))31))))(\\d{3})";
    NSPredicate *valueTest2 = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", valueRegex2];
    return [valueTest1 evaluateWithObject:value] || [valueTest2 evaluateWithObject:value];
}

+ (float)getScreenWidth {
    return [UIScreen mainScreen].bounds.size.width;
}

+ (float)getScreenHeight {
    return [UIScreen mainScreen].bounds.size.height;
}

/**
 *	@brief	根据范围和颜色画出图片
 *
 *	@param 	color 	颜色
 *	@param 	rect 	范围
 *
 *	@return	返回UIImage
 */
+ (UIImage *)imageWithColor:(UIColor *)color withRect:(CGRect)rect {
    UIGraphicsBeginImageContext(rect.size);
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextSetFillColorWithColor(context, [color CGColor]);
    CGContextFillRect(context, rect);
    
    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    
    return image;
}

/**
 *	@brief	根据输入文档名返回路径
 *
 *	@param 	kFileName 	输入文档名
 *
 *	@return	返回路径
 */
+ (NSString *)dataFilePath:(NSString *)kFileName {
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];
    return [documentsDirectory stringByAppendingPathComponent:kFileName];
}

+ (NSString *)getFormatLeaveTime:(NSString *)theDate {
    if ([theDate length] > 19) {
        theDate = [theDate substringToIndex:19];
    }
    NSDateFormatter *date = [[NSDateFormatter alloc] init];
    [date setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSDate *d = [date dateFromString:theDate];
    NSTimeInterval late = [d timeIntervalSince1970] * 1;
    
    NSDate *dat = [NSDate dateWithTimeIntervalSinceNow:0];
    NSTimeInterval now = [dat timeIntervalSince1970] * 1;
    
    static const double second = 1;
    static const double minute = second * 60;
    static const double hour = minute * 60;
    static const double day = hour * 24;
    
    NSTimeInterval cha = late - now;
    if (cha <= 0) {
        cha = 0;
    } else if (cha > 0 && cha <= 60) {
        cha = 60;
    }
    
    double days = 0, hours = 0, minutes = 0;
    
    days = floor(cha / day);
    cha -= day * days;
    
    hours = floor(cha / hour);
    cha -= hour * hours;
    
    minutes = floor(cha / minute);
    cha -= minute * minutes;
    
    return [NSString stringWithFormat:@"%.0lf天%.0lf小时%.0lf分", days, hours, minutes];
}

+ (UIImage *)scaleAndRotateImage:(UIImage *)photoimage
                           width:(CGFloat)bounds_width
                          height:(CGFloat)bounds_height
                        isCamera:(BOOL)isCamera{
    CGImageRef imgRef =photoimage.CGImage;
    
    CGFloat width = CGImageGetWidth(imgRef);
    CGFloat height = CGImageGetHeight(imgRef);
    
    
    CGAffineTransform transform = CGAffineTransformIdentity;
    CGRect bounds = CGRectMake(0, 0, width, height);
    
    
    CGFloat scaleRatio = bounds_width / width;
    CGFloat scaleRatioheight = bounds_height / height;
    CGSize imageSize = CGSizeMake(CGImageGetWidth(imgRef), CGImageGetHeight(imgRef));
    
    UIImageOrientation orient =photoimage.imageOrientation;
    if (isCamera) {
        bounds.size.width = bounds_height;
        bounds.size.height = bounds_width;
        switch(orient) {
                /*
                 case UIImageOrientationUp: //EXIF = 1
                 transform = CGAffineTransformIdentity;
                 break;
                 case UIImageOrientationUpMirrored: //EXIF = 2
                 transform = CGAffineTransformMakeTranslation(imageSize.width, 0.0);
                 transform = CGAffineTransformScale(transform, -1.0, 1.0);
                 break;
                 
                 case UIImageOrientationDown: //EXIF = 3
                 transform = CGAffineTransformMakeTranslation(imageSize.width, imageSize.height);
                 transform = CGAffineTransformRotate(transform, M_PI);
                 break;
                 
                 case UIImageOrientationDownMirrored: //EXIF = 4
                 transform = CGAffineTransformMakeTranslation(0.0, imageSize.height);
                 transform = CGAffineTransformScale(transform, 1.0, -1.0);
                 break;
                 */
            case UIImageOrientationDownMirrored:
            case UIImageOrientationLeftMirrored: //EXIF = 5
                
                transform = CGAffineTransformMakeTranslation(imageSize.height, imageSize.width);
                transform = CGAffineTransformScale(transform, -1.0, 1.0);
                transform = CGAffineTransformRotate(transform, 3.0 * M_PI / 2.0);
                break;
            case UIImageOrientationDown:
            case UIImageOrientationLeft: //EXIF = 6
                
                transform = CGAffineTransformMakeTranslation(0.0, imageSize.width);
                transform = CGAffineTransformRotate(transform, 3.0 * M_PI / 2.0);
                break;
            case UIImageOrientationUpMirrored:
            case UIImageOrientationRightMirrored: //EXIF = 7
                
                transform = CGAffineTransformMakeScale(-1.0, 1.0);
                transform = CGAffineTransformRotate(transform, M_PI / 2.0);
                break;
            case UIImageOrientationUp:
            case UIImageOrientationRight: //EXIF = 8
                
                transform = CGAffineTransformMakeTranslation(imageSize.height, 0.0);
                transform = CGAffineTransformRotate(transform, M_PI / 2.0);
                break;
                
            default:
                [NSException raise:NSInternalInconsistencyException format:@"Invalid?image?orientation"];
                break;
        }
    }
    else {
        CGFloat boundHeight;
        
        bounds.size.width = bounds_width;
        bounds.size.height = bounds_height;
        switch(orient)
        {
            case UIImageOrientationUp: //EXIF = 1
                transform = CGAffineTransformIdentity;
                break;
            case UIImageOrientationUpMirrored: //EXIF = 2
                transform = CGAffineTransformMakeTranslation(width, 0.0);
                transform = CGAffineTransformScale(transform, -1.0, 1.0);
                break;
            case UIImageOrientationDown: //EXIF = 3
                transform = CGAffineTransformMakeTranslation(width, height);
                transform = CGAffineTransformRotate(transform, M_PI);
                break;
            case UIImageOrientationDownMirrored: //EXIF = 4
                transform = CGAffineTransformMakeTranslation(0.0, height);
                transform = CGAffineTransformScale(transform, 1.0, -1.0);
                break;
            case UIImageOrientationLeftMirrored: //EXIF = 5
                boundHeight = bounds.size.height;
                bounds.size.height = bounds.size.width;
                bounds.size.width = boundHeight;
                transform = CGAffineTransformMakeTranslation(height, width);
                transform = CGAffineTransformScale(transform, -1.0, 1.0);
                transform = CGAffineTransformRotate(transform, 3.0 * M_PI / 2.0);
                break;
            case UIImageOrientationLeft: //EXIF = 6
                boundHeight = bounds.size.height;
                bounds.size.height = bounds.size.width;
                bounds.size.width = boundHeight;
                transform = CGAffineTransformMakeTranslation(0.0, width);
                transform = CGAffineTransformRotate(transform, 3.0 * M_PI / 2.0);
                break;
            case UIImageOrientationRightMirrored: //EXIF = 7
                boundHeight = bounds.size.height;
                bounds.size.height = bounds.size.width;
                bounds.size.width = boundHeight;
                transform = CGAffineTransformMakeScale(-1.0, 1.0);
                transform = CGAffineTransformRotate(transform, M_PI / 2.0);
                break;
            case UIImageOrientationRight: //EXIF = 8
                boundHeight = bounds.size.height;
                bounds.size.height = bounds.size.width;
                bounds.size.width = boundHeight;
                transform = CGAffineTransformMakeTranslation(height, 0.0);
                transform = CGAffineTransformRotate(transform, M_PI / 2.0);
                break;
        }
    }
    
    
    UIGraphicsBeginImageContext(bounds.size);
    
    CGContextRef context = UIGraphicsGetCurrentContext();
    
    if (isCamera || orient == UIImageOrientationLeft || orient == UIImageOrientationRight) {
        CGContextScaleCTM(context, -scaleRatio, scaleRatioheight);
        CGContextTranslateCTM(context, -height, 0);
    } else {
        CGContextScaleCTM(context, scaleRatio, -scaleRatioheight);
        CGContextTranslateCTM(context, 0, -height);
    }
    
    CGContextConcatCTM(context, transform);
    
    CGContextDrawImage(UIGraphicsGetCurrentContext(), CGRectMake(0, 0, width, height), imgRef);
    UIImage *imageCopy = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return imageCopy;
}

+ (UIImage*)OriginImage:(UIImage*)image scaleToSize:(CGSize)size {
    UIGraphicsBeginImageContext(size);
    [image drawInRect:CGRectMake(0, 0, size.width, size.height)];
    UIImage* scaledImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return scaledImage;
}


+ (NSString *)getDocumentDirectory {
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    return [paths objectAtIndex:0];
}

+ (NSString *)getCacheDirectory {
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
    return [paths objectAtIndex:0];
}

+ (NSString *)getCacheImagePath {
    return [[[self getCacheDirectory] stringByAppendingPathComponent:@"LVMM"] stringByAppendingPathComponent:@"image"];
}

+ (NSString *)getPassbookPath {
    return [[[self getCacheDirectory] stringByAppendingPathComponent:@"LVMM"] stringByAppendingPathComponent:@"passbook"];
}

+ (NSString *)getBrowseHistoryPath {
    NSFileManager *fileManager = [NSFileManager defaultManager];
    NSString *path = [[[self getCacheDirectory] stringByAppendingPathComponent:@"LVMM"] stringByAppendingPathComponent:@"browse"];
    if (![fileManager fileExistsAtPath:path]) {
        NSError *err;
        //创建文件夹
        BOOL createSuccess = [fileManager createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil error:&err];
        if (!createSuccess) {
            return nil;
        }
    }
    return path;
}

+ (NSString *)getTmpDirectory {
    NSString *tmpDir = NSTemporaryDirectory();
    return tmpDir;
}

+ (NSString *)getH5TmpDirectoryWithFileName:(NSString *)fileName {
    return [[self getTmpDirectory] stringByAppendingPathComponent:fileName];
}

+ (NSString *)getCacheH5Path {
    return [self getCachePath];
}

+ (NSString *)getCachePath {
    NSFileManager *fileManager = [NSFileManager defaultManager];
    NSString *path = [[self getCacheDirectory] stringByAppendingPathComponent:@"Trackit"];
    if (![fileManager fileExistsAtPath:path]) {
        NSError *err;
        //创建文件夹
        BOOL createSuccess = [fileManager createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil error:&err];
        if (!createSuccess) {
            return nil;
        }
    }
    return path;
}

+ (NSString *)getTrackitCachePathByID:(NSString *)idString {
    NSFileManager *fileManager = [NSFileManager defaultManager];
    NSString *path = [[self getCachePath] stringByAppendingPathComponent:idString];
    if (![fileManager fileExistsAtPath:path]) {
        NSError *err;
        //创建文件夹
        BOOL createSuccess = [fileManager createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil error:&err];
        if (!createSuccess) {
            return nil;
        }
    }
    return path;
}


+ (BOOL)deleteCacheImage {
    NSFileManager *fileManager = [NSFileManager defaultManager];
    return [fileManager isReadableFileAtPath:[self getCacheImagePath]];
}

+ (NSString *)getMacAddress {
    int mib[6];
    size_t len;
    char* buf;
    unsigned char* ptr;
    struct if_msghdr* ifm;
    struct sockaddr_dl* sdl;
    
    mib[0] = CTL_NET;
    mib[1] = AF_ROUTE;
    mib[2] = 0;
    mib[3] = AF_LINK;
    mib[4] = NET_RT_IFLIST;
    
    if ((mib[5] = if_nametoindex("en0")) == 0) {
        printf("Error: if_nametoindex error\n");
        return nil;
    }
    
    if (sysctl(mib, 6, NULL, &len, NULL, 0) < 0) {
        printf("Error: sysctl, take 1\n");
        return nil;
    }
    
    if ((buf = malloc(len)) == NULL) {
        printf("Could not allocate memory. error!\n");
        return nil;
    }
    
    if (sysctl(mib, 6, buf, &len, NULL, 0) < 0) {
        printf("Error: sysctl, take 2");
        free(buf);
        return nil;
    }
    
    ifm = (struct if_msghdr*)buf;
    sdl = (struct sockaddr_dl*)(ifm + 1);
    ptr = (unsigned char*)LLADDR(sdl);
    NSString *outstring = [NSString stringWithFormat: @"%02x:%02x:%02x:%02x:%02x:%02x", *ptr, *(ptr + 1), *(ptr + 2), *(ptr + 3), *(ptr + 4), *(ptr + 5)];
    free(buf);
    return [outstring uppercaseString];
}

/**
 *	@brief	MD5加密
 *
 *	@param 	str 	需加密字符串
 *
 *	@return	返回MD5加密后字符串
 */
+ (NSString *)getMd5:(NSString *)str {
    if (str == nil || [str length] == 0) {
        return nil;
    }
    const char *value = [str UTF8String];
    unsigned char outputBuffer[CC_MD5_DIGEST_LENGTH];
    CC_MD5(value, (uint32_t)strlen(value), outputBuffer);
    
    NSMutableString *outputString = [[NSMutableString alloc] initWithCapacity:CC_MD5_DIGEST_LENGTH * 2];
    for (NSInteger count = 0; count < CC_MD5_DIGEST_LENGTH; count++){
        [outputString appendFormat:@"%02x",outputBuffer[count]];
    }
    return outputString;
}

+ (NSString *)uniqueMacMd5Identifier {
    NSString *macAddress = [CommonFunction getMacAddress];
    NSString *bundleIdentifier = [[NSBundle mainBundle] bundleIdentifier];
    NSString *stringToHash = [NSString stringWithFormat:@"%@%@", macAddress, bundleIdentifier];
    NSString *identifier = [CommonFunction getMd5:stringToHash];
    return identifier;
}

/**
 *	@brief	将字符串根据字体大小、是否加粗、显示宽度来算出字符串的高度
 *
 *	@param 	textWidth 	显示宽度
 *	@param 	text        字符串内容
 *	@param 	fontSize 	字体
 *	@param 	isBold      是否加粗
 *
 *	@return	返回高度
 */
+ (CGFloat)getTextHeight:(CGFloat)textWidth text:(NSString *)text fontSize:(CGFloat)fontSize isBold:(BOOL)isBold {
    if ([text length] == 0) {
        return 0;
    }
    if (isBold) {
        return [text boundingRectWithSize:CGSizeMake(textWidth, MAXFLOAT)
                                  options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading
                               attributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIFont boldSystemFontOfSize:fontSize], NSFontAttributeName, nil]
                                  context:nil].size.height;
    } else {
        return [text boundingRectWithSize:CGSizeMake(textWidth, MAXFLOAT)
                                  options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading
                               attributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:fontSize], NSFontAttributeName, nil]
                                  context:nil].size.height;
    }
    return 0;
}

/**
 *	@brief	将字符串根据字体大小、是否加粗、显示高度来算出字符串的宽度
 *
 *	@param 	textHeight 	显示高度
 *	@param 	text        字符串内容
 *	@param 	fontSize 	字体大小
 *	@param 	isBold      是否加粗
 *
 *	@return	返回宽度
 */
+ (CGFloat)getTextWidth:(CGFloat)textHeight text:(NSString *)text fontSize:(CGFloat)fontSize isBold:(BOOL)isBold {
    if ([text length] == 0) {
        return 0;
    }
    if (isBold) {
        return [text boundingRectWithSize:CGSizeMake(MAXFLOAT, textHeight)
                                  options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading
                               attributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIFont boldSystemFontOfSize:fontSize], NSFontAttributeName, nil]
                                  context:nil].size.width;
    } else {
        return [text boundingRectWithSize:CGSizeMake(MAXFLOAT, textHeight)
                                  options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading
                               attributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:fontSize], NSFontAttributeName, nil]
                                  context:nil].size.width;
    }
    return 0;
}

/**
 *	@brief	判断当前设备型号
 *
 *	@return	将获取的设备型号返回
 */
+ (NSString*)deviceString {
    // 需要#import "sys/utsname.h"
    struct utsname systemInfo;
    uname(&systemInfo);
    NSString *deviceString = [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding];
    /*
     if ([deviceString isEqualToString:@"iPhone1,1"])    return @"iPhone 1G";
     if ([deviceString isEqualToString:@"iPhone1,2"])    return @"iPhone 3G";
     if ([deviceString isEqualToString:@"iPhone2,1"])    return @"iPhone 3GS";
     if ([deviceString isEqualToString:@"iPhone3,1"])    return @"iPhone 4";
     if ([deviceString isEqualToString:@"iPhone4,1"])    return @"iPhone 4S";
     if ([deviceString isEqualToString:@"iPhone5,2"])    return @"iPhone 5";
     if ([deviceString isEqualToString:@"iPhone3,2"])    return @"Verizon iPhone 4";
     if ([deviceString isEqualToString:@"iPod1,1"])      return @"iPod Touch 1G";
     if ([deviceString isEqualToString:@"iPod2,1"])      return @"iPod Touch 2G";
     if ([deviceString isEqualToString:@"iPod3,1"])      return @"iPod Touch 3G";
     if ([deviceString isEqualToString:@"iPod4,1"])      return @"iPod Touch 4G";
     if ([deviceString isEqualToString:@"iPad1,1"])      return @"iPad";
     if ([deviceString isEqualToString:@"iPad2,1"])      return @"iPad 2 (WiFi)";
     if ([deviceString isEqualToString:@"iPad2,2"])      return @"iPad 2 (GSM)";
     if ([deviceString isEqualToString:@"iPad2,3"])      return @"iPad 2 (CDMA)";
     if ([deviceString isEqualToString:@"i386"])         return @"Simulator";
     if ([deviceString isEqualToString:@"x86_64"])       return @"Simulator";
     LVLog(@"NOTE: Unknown device type: %@", deviceString);
     */
    return deviceString;
}


/**
 *	@brief	获取UUID
 *
 *	@return	返回UUID
 */
+ (NSString *)stringWithUUID {
    CFUUIDRef uuidObj = CFUUIDCreate(nil);
    NSString *uuidString = (NSString *)CFBridgingRelease(CFUUIDCreateString(nil, uuidObj));
    CFRelease(uuidObj);
    return uuidString;
}

/**
 *	@brief	格式化手机号
 *
 *	@param 	mobile 	输入手机号码
 *
 *	@return	返回格式化后手机号码
 */
+ (NSString *)formatMobile:(NSString *)mobile {
    if ([mobile hasPrefix:@"+86"]) {
        mobile = [mobile substringFromIndex:3];
    }
    mobile = [mobile stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
    mobile = [mobile stringByReplacingOccurrencesOfString:@"-" withString:@""];
    mobile = [mobile stringByReplacingOccurrencesOfString:@"(" withString:@""];
    mobile = [mobile stringByReplacingOccurrencesOfString:@")" withString:@""];
    mobile = [mobile stringByReplacingOccurrencesOfString:@" " withString:@""];
    mobile = [mobile stringByReplacingOccurrencesOfString:@"  " withString:@""];
    return mobile;
}

+ (NSString *)getTrimString:(id)str {
    if (str) {
        return [str stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
    }
    return @"";
}

/**
 查找parentView的子view类型为type的View
 @param type 类型
 @returns 为该类型的第一个View
 */
+ (UIView *) parentView:(UIView *)parentView subViewByType:(Class)type {
    for (UIView *subView in parentView.subviews) {
        if([subView isKindOfClass:type])
            return subView;
    }
    return nil;
}

+ (NSString *)flattenHTML:(NSString *)html {
    NSScanner *theScanner;
    NSString *text1 = nil;
    theScanner = [NSScanner scannerWithString:html];
    while (![theScanner isAtEnd]) {
        [theScanner scanUpToString:@"&lt;" intoString:NULL];
        [theScanner scanUpToString:@"&gt;" intoString:&text1];
        html = [html stringByReplacingOccurrencesOfString:[NSString stringWithFormat:@"%@&gt;", text1]
                                               withString:@" "];
    }
    NSString *text2 = nil;
    theScanner = [NSScanner scannerWithString:html];
    while (![theScanner isAtEnd]) {
        [theScanner scanUpToString:@"<" intoString:NULL];
        [theScanner scanUpToString:@">" intoString:&text2];
        html = [html stringByReplacingOccurrencesOfString:[NSString stringWithFormat:@"%@>", text2]
                                               withString:@""];
    }
    return [self replaceByCustomKey:html];
}

+ (NSString *)replaceByCustomKey:(NSString *)replaceStr {
    NSMutableArray *keyArray = [NSMutableArray arrayWithObjects:@"&#xd;",@"&gt;", nil];
    NSMutableArray *keyValue = [NSMutableArray arrayWithObjects:@"",@">", nil];
    for (int i = 0; i < [keyArray count]; i++) {
        NSString *key = [keyArray objectAtIndex:i];
        NSString *value = [keyValue objectAtIndex:i];
        replaceStr = [replaceStr stringByReplacingOccurrencesOfString:key withString:value];
    }
    return replaceStr;
}

+ (void)clearLvSessionCookie {
    NSHTTPCookieStorage *cookieStorage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
    NSArray *_tmpArray = [NSArray arrayWithArray:[cookieStorage cookies]];
    for (NSHTTPCookie *cookie in _tmpArray) {
        if ([cookie.name isEqualToString:@"lvsessionid"]) {
            [cookieStorage deleteCookie:cookie];
        }
    }
}

+ (NSString *)getNumberStringValue:(float)number {
    NSString *numberValue = @"";
    if ([[NSString stringWithFormat:@"%.2f", number] floatValue] == [[NSString stringWithFormat:@"%.1f", number] floatValue]) {
        numberValue = [NSString stringWithFormat:@"%.1f", number];
        //        if ([[NSString stringWithFormat:@"%.1f", number] floatValue] == (int)number) {
        //            numberValue = [NSString stringWithFormat:@"%i", (int)number];
        //        }
    } else {
        numberValue = [NSString stringWithFormat:@"%.2f", number];
    }
    return numberValue;
}

+ (NSString *)getIPAddress {
    NSString *address = @"error";
    struct ifaddrs *interfaces = NULL;
    struct ifaddrs *temp_addr = NULL;
    int success = 0;
    
    // retrieve the current interfaces - returns 0 on success
    success = getifaddrs(&interfaces);
    if (success == 0) {
        // Loop through linked list of interfaces
        temp_addr = interfaces;
        while(temp_addr != NULL) {
            if(temp_addr->ifa_addr->sa_family == AF_INET) {
                // Check if interface is en0 which is the wifi connection on the iPhone
                if([[NSString stringWithUTF8String:temp_addr->ifa_name] isEqualToString:@"en1"]) {
                    // Get NSString from C String
                    address = [NSString stringWithUTF8String:inet_ntoa(((struct sockaddr_in *)temp_addr->ifa_addr)->sin_addr)];
                }
            }
            temp_addr = temp_addr->ifa_next;
        }
    }
    // Free memory
    freeifaddrs(interfaces);
    return address;
}

+ (NSString *)intToString:(NSInteger)num {
    if (num<1||num>12) {
        return @"";
    }
    NSArray *arr = @[@"一",@"二",@"三",@"四",@"五",@"六",@"七",@"八",@"九",@"十",@"十一",@"十二"];
    return arr[num-1];
}

+ (NSDateComponents *)componentsFromDateString:(NSString*)dateStr {
    NSCalendar *cal = [NSCalendar currentCalendar];
    unsigned units  = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay;
    NSDateComponents *components = [cal components:units fromDate:[self dateFromString:dateStr format:@"yyyy-MM-dd"]];
    return components;
}


+ (NSString *)Version {
    return [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]?:@"";
}

//获得屏幕图像
+ (UIImage *)imageFromView:(UIView *)theView {
    return [self imageFromView:theView cover:nil];
}

//获得某个范围内的屏幕图像
+ (UIImage *)imageFromView:(UIView *)theView atFrame:(CGRect)r {
    UIGraphicsBeginImageContext(theView.frame.size);
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextSaveGState(context);
    UIRectClip(r);
    [theView.layer renderInContext:context];
    UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    
    return  theImage;//[self getImageAreaFromImage:theImage atFrame:r];
}

+ (UIImage *)imageFromView:(UIView *)theView cover:(UIImage *)coverImage {
    UIGraphicsBeginImageContext(theView.frame.size);
    CGContextRef context = UIGraphicsGetCurrentContext();
    [theView.layer renderInContext:context];
    if (coverImage) {
        [coverImage drawInRect:CGRectMake(0, CGRectGetHeight(theView.frame)-coverImage.size.height, coverImage.size.width, coverImage.size.height)];
    }
    UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    
    return theImage;
}

+ (int)floatToInt:(float)f {
    int i = 0;
    if(f>0) //正数
        i = (f*10 + 5)/10;
    else if(f<0) //负数
        i = (f*10 - 5)/10;
    else i = 0;
    
    return i;
}


static NSString *chineseFirstPY = @"YDYQSXMWZSSXJBYMGCCZQPSSQBYCDSCDQLDYLYBSSJGYZZJJFKCCLZDHWDWZJLJPFYYNWJJTMYHZWZHFLZPPQHGSCYYYNJQYXXGJ"
@"HHSDSJNKKTMOMLCRXYPSNQSECCQZGGLLYJLMYZZSECYKYYHQWJSSGGYXYZYJWWKDJHYCHMYXJTLXJYQBYXZLDWRDJRWYSRLDZJPC"
@"BZJJBRCFTLECZSTZFXXZHTRQHYBDLYCZSSYMMRFMYQZ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)isFirstPinyin {
    NSString *spelling = @"";
    if (chinese.length == 0) {
        return spelling;
    }
    const unsigned short *bsConvert;
    
    unsigned short location;
    NSUInteger count = isFirstPinyin?1:chinese.length;
    for (int i = 0; i < count; i++) {
        bsConvert = (unsigned short *)[[chinese substringFromIndex:i] cStringUsingEncoding:NSUnicodeStringEncoding];
        location = *bsConvert;
        if ((location >= 'a' && location <= 'z') || (location>='A' && location <= 'Z')) {
            spelling = [spelling stringByAppendingFormat:@"%c", location];
            continue;
        }
        if (location < 256) {
            spelling = [spelling stringByAppendingFormat:@"%c", location];
            continue;
        }
        if (location >= 19968 && location <= 40869) {
            spelling = [spelling stringByAppendingFormat:@"%c", [chineseFirstPY characterAtIndex:location - 19968]];
            continue;
        }
    }
    return spelling;
}

+ (NSInteger)convertToInt:(NSString*)strtemp {
    NSInteger i,n=[strtemp length],l=0,a=0,b=0;
    unichar c;
    for(i=0;i<n;i++){
        c=[strtemp characterAtIndex:i];
        if(isblank(c)){
            b++;
        }else if(isascii(c)){
            a++;
        }else{
            l++;
        }
    }
    if(a==0 && l==0) return 0;
    return l+(int)ceilf((float)(a+b)/2.0);
}

+ (NSString *)getDistance:(double)distance {
    if (distance < 0) {
        return @"";
    } else if (distance < 100) {
        return @"<100m";
    } else if (distance < 1000) {
        return [NSString stringWithFormat:@"%.0fm",distance];
    } else {
        return [NSString stringWithFormat:@"%.1fkm",distance/1000];
    }
}

+ (BOOL)inputOverRange:(NSString *)originStr limittedNumber:(NSInteger)limittedNum {
    return [self convertToInt:originStr] > limittedNum;
}

+ (double)getDistanceNumber:(CLLocationCoordinate2D)newCoordinate locationOld:(CLLocationCoordinate2D)oldCoordinate {
    CLLocation *locNew = [[CLLocation alloc]initWithLatitude:newCoordinate.latitude longitude:newCoordinate.longitude];
    CLLocation *locOld = [[CLLocation alloc]initWithLatitude:oldCoordinate.latitude longitude:oldCoordinate.longitude];
    CLLocationDistance distanceValue = [locNew distanceFromLocation:locOld];
    return distanceValue;
}

+ (NSString *)chineseToPinYin:(NSString*)sourceString {
    NSMutableString *source = [sourceString mutableCopy];
    CFStringTransform((__bridge CFMutableStringRef)source, NULL, kCFStringTransformMandarinLatin, NO);
    CFStringTransform((__bridge CFMutableStringRef)source, NULL, kCFStringTransformStripDiacritics, NO);
    
    return [source stringByReplacingOccurrencesOfString:@" " withString:@""];
}

//是否安装第三方地图APP
+ (BOOL)installBaiduMapApp {
    return [[UIApplication sharedApplication]canOpenURL:[NSURL URLWithString:@"baidumap://map/direction"]];
}

+ (BOOL)installGaodeMapApp {
    return [[UIApplication sharedApplication]canOpenURL:[NSURL URLWithString:@"iosamap://"]];
    
}

+ (NSString *)daySpecialStringFromdDate:(NSDate *)aDate { //返回 今天、明天、后天  若不符合 则返回空
    if (aDate == nil) {
        return @"";
    }
    NSDate *now = [NSDate date];
    unsigned int flags = NSCalendarUnitDay | NSCalendarUnitMonth | NSCalendarUnitYear ;
    NSDateComponents* nowP = [[NSCalendar currentCalendar] components:flags fromDate:now];
    NSDateComponents* parts2 = [[NSCalendar currentCalendar] components:flags fromDate:aDate];
    
    if (parts2.month == nowP.month&&nowP.year == parts2.year) {
        if (nowP.day==parts2.day) {
            return @"今天";
        }else if (nowP.day+1==parts2.day){
            return @"明天";
        }else if (nowP.day+2==parts2.day){
            return @"后天";
        }else
            return @"";
    }else
        return @"";
}

+ (NSString *)dayStringFromDate:(NSDate *)aDate {  //返回 周一、周二、周三...
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    [formatter setTimeZone:[NSTimeZone defaultTimeZone]];
    [formatter setDateFormat:@"EE"];
    formatter.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"zh_CN"];
    NSString *dateString = [formatter stringFromDate:aDate];
    return dateString;
}

+ (NSString *)weekStringFromDate:(NSDate *)aDate {
    NSString *day = [self daySpecialStringFromdDate:aDate];
    if (day.length>0) {
        return day;
    }
    
    return [self dayStringFromDate:aDate];
}

+ (NSString *)weekDayFormDateString:(NSString *)dateString {
    NSDate *date = [CommonFunction dateFromString:dateString format:@"yyyy-MM-dd"];
    return [CommonFunction weekStringFromDate:date];
}

//从NSDate 显示 。。月。。日
+ (NSString *)monthDayFormDate:(NSDate *)date {
    return [CommonFunction stringFromDate:date format:@"MM月dd日"];
}

//从NSString 显示 。。月。。日
+ (NSString *)monthDayFormDateString:(NSString *)dateString {
    NSDate *date = [CommonFunction dateFromString:dateString format:@"yyyy-MM-dd"];
    return [CommonFunction monthDayFormDate:date];
}

//从NSDate 显示  年。。月。。日
+ (NSString *)yearDayFormDate:(NSDate *)date {
    return [CommonFunction stringFromDate:date format:@"yyyy年MM月dd日"];
}

+ (NSString *)yearDayFormDateString:(NSString *)dateString {
    NSDate *date = [CommonFunction dateFromString:dateString format:@"yyyy-MM-dd"];
    return [CommonFunction yearDayFormDate:date];
}

//返回时间戳
+ (double )timeDateString:(NSString *)dateString {
    NSDate *date = [CommonFunction dateFromString:dateString format:@"yyyy-MM-dd-hh-mm-ss"];
    double dataTime = (double)[date timeIntervalSince1970];
    return dataTime;
}

//获取指定日期后的第几天，返回NSDate
+ (NSDate *)getFutureDateByServalDay:(NSDate *)aDate inDays:(int)days {
    NSCalendar *gregorian = [NSCalendar currentCalendar];
    gregorian.locale = [NSLocale systemLocale];
    NSDateComponents *components = [gregorian components:NSCalendarUnitWeekday | NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay fromDate:aDate ? aDate : [NSDate date]];
    [components setDay:([components day] + days)];
    NSDate *beginningOfWeek = [gregorian dateFromComponents:components];
    return beginningOfWeek;
}

//获取指定日期后的第几天，返回NSDate
+ (NSDate *)getFutureDateByServalMonth:(NSDate *)aDate inMonths:(int)months {
    NSCalendar *gregorian = [NSCalendar currentCalendar];
    gregorian.locale = [NSLocale systemLocale];
    NSDateComponents *components = [gregorian components:NSCalendarUnitWeekday | NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay fromDate:aDate ? aDate : [NSDate date]];
    [components setMonth:([components month] + months)];
    NSDate *beginningOfMonth = [gregorian dateFromComponents:components];
    return beginningOfMonth;
}

+ (NSString*)convertToJSONData:(id)infoDict {
    NSError *error;
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:infoDict
                                                       options:NSJSONWritingPrettyPrinted
                                                         error:&error];
    
    NSString *jsonString = @"";
    
    if (!jsonData) {
        NSLog(@"Got an error: %@", error);
    } else {
        jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
    }
    jsonString = [jsonString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];  //去除掉首尾的空白字符和换行字符
    [jsonString stringByReplacingOccurrencesOfString:@"\n" withString:@""];
    return jsonString;
}

//iOS 获取当前手机系统语言

/**
 *得到本机现在用的语言
 * en-CN 或en  英文  zh-Hans-CN或zh-Hans  简体中文   zh-Hant-CN或zh-Hant  繁体中文    ja-CN或ja  日本  ......
 */
+ (NSString *)getPreferredLanguage {
    NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
    NSArray *languages = [defs objectForKey:@"AppleLanguages"];
    NSString *preferredLang = [languages objectAtIndex:0];
    return preferredLang;
}
@end
